<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<t:base type="jquery,easyui,DatePicker"></t:base>
<script src="plug-in/echart/echarts.min.js"></script>
<div class="easyui-layout" fit="true">
 <div region="north" style="padding:0px;border:0px;height:200px;">
 	<div class="easyui-layout" fit="true">
 	<div region="center">
		<div id="main2" style="height:180px;width:60%;" ></div>
	</div>
 	</div> 
 </div>

  <div region="center" style="padding:0px;border:0px">
  <t:datagrid name="deviceList"  fitColumns="true" title="实验室使用记录" actionUrl="labUseRptController.do?lessonDatagrid" idField="id" fit="true" queryMode="group">
   <t:dgCol title="主键"  field="id"  hidden="true"  queryMode="single"  width="30"></t:dgCol>
   <t:dgCol title="实验室" field="lab.id" hidden="true" query="true" queryMode="single" replace="${labNames }"></t:dgCol>
   <t:dgCol title="实验室" field="lab.name" queryMode="single" width="120"></t:dgCol>
   <t:dgCol title="节次"  field="openRecord.lesson" query="false" queryMode="single"  width="120"></t:dgCol> 
   <t:dgCol title="预约人"  field="appointUser.realName"    queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="预约座位"  field="appointSeat"    queryMode="single"  width="120"></t:dgCol>
   <t:dgCol title="指导老师"  field="teacher.realName"    queryMode="single"  width="120"></t:dgCol>  
   
  </t:datagrid>
  </div>
 </div>
   
  <script type="text/javascript">
  
  $(document).ready(function(){
	  fillRpt2();
	  $(".icon-search").parent().parent().on('click', function(){
		  fillRpt2();
	  });
	  $(".icon-reload").parent().parent().on('click', function(){
		  fillRpt2();
	  });
  });
  
  function fillRpt2(){
	  var labId = $("#deviceListtb").find("[name='lab.id'] option:selected").val();
	  $.ajax({
		  url:"./labUseRptController.do?lessonRptData&labId="+labId,
		  success:function(d){
			  d = $.parseJSON(d); 
			  option2 = {
					  title : {
					        text: '实验室分析 ',
					        subtext: '',
					        x:'center'
					    },
					    tooltip : {
					        trigger: 'axis',
					        axisPointer : {            // 坐标轴指示器，坐标轴触发有效
					            type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
					        }
					    },
					    legend: {
					    	orient: 'vertical',
						    left: 'left',
					        data:["实验室"]
					    },
					    grid: {
					        left: '3%',
					        right: '4%',
					        bottom: '3%',
					        containLabel: true
					    },
					    xAxis : [
					        {
					            type : 'category',
					            data : []
					        }
					    ],
					    yAxis : [
					        {
					            type : 'value'
					        }
					    ],
					    series : [
					        {
					            name:'使用量',
					            type:'bar',
					            data:[]
					        }
					    ]
					};
			  
			  for(var i=0;i<d.length;i++){
				  var rpt = d[i];
				  option2.xAxis[0].data.push('节次：'+rpt.lesson);
				  option2.series[0].data.push(rpt.count);
			  }
			  
			  var myChart2 = echarts.init(document.getElementById('main2'));
			  myChart2.setOption(option2);
			  
		  }
	  });
  } 
 
</script>
 